Objects and Materials Part 1 (Wavefront 3D Model Specification)

3 minute read

Published:

1.1. wavefront .obj

the OBJ format, the MTL format was used and documented by Wavefront Technologies in the 1990s in association with its Advanced Visualizer software. Object files can be in ASCII format (.obj) or binary format (.mod). Vertices are stored in a counter-clockwise, and in object space (un-normalized).

  1. v : vertex
    • find in different ranges, e.g., 0.0-1.0,
    • v 1380.6033 -115.9791 -782.5203
    • v -0.122936 1.00032 0.35065
    • (x, y, z [,w]) w is optional and defaults to 1.0
  2. vt : texture (uv) position [-1.0 to 1.0] of each texture coordinate vertex
    • vt 0.5767 0.5096 0.0000 (sponza scene)
    • List of texture coordinates, in (u, [,v ,w]) coordinates, ~these will vary between -1 and 1. v, w are optional and default to 0.~
  3. vn: vertex normal, in (x,y,z) form
    • vn -0.1776 -0.8781 -0.4443 (sponza scene)
  4. f: polygon faces that make each polygon defined as a list of vertices. vertex/texture/normal
    • f 147019/91297/142810 147015/91295/142806 147014/91131/142728 147022/91139/142813 (sponza scene)
  5. s: smoothing group
  6. vp -> Parameter space vertices in ( u [,v] [,w] )
    • Free-form curve/surface attributes
  7. l # Line element (see below)

1.2. mtl (material template library)

he MTL specification, as published in 1995, includes a substantial number of options that are typically not supported in today’s software.

// sponza scene material (tail)
newmtl roof                                    // sequence of material definitions, each beginning with the keyword

	Ns 10.0000                             // specular highlights, normally 0-1000, higher value resulting in a tight, 
                                               // concentrated highlight. Default is 0.0
	Ni 1.5000                              // optical density (aka index of refraction), 0.001-10. A value of 1.0 means that light
                                               // does not bend as it passes through an object

// alpha values (d = 1 means fully opaque, Tr = 0 means fully opaque  
	d 1.0000                               // alpha value (aka. factor for dissolve, how much this material dissolves into the background. A factor of 1.0 
                                               // is fully opaque. A factor of 0.0 is completely transparent
	Tr 0.0000                              // alpha, defines the transparency of the material to be alpha. 
                                               // The default is 0.0 (not transparent at all). 
                                               // The quantities d and Tr are the opposites of each other, and specifying transparency or 
                                               // nontransparency is simply a matter of user convenience.

//
	Tf 1.0000 1.0000 1.0000                // transmission filter
	illum 2                                // illumination model
                                               // illum = 1 indicates a flat material with no specular highlights, so the value of Ks is not used.                                          // illum = 2 denotes the presence of specular highlights, and so a specification for Ks is required.
	Ka 1 1 1                               // ambient color 0-1 (phong reflection model/ phong illumination/ phong lighting)
	Kd 1 1 1                               // diffuse color (0-1)
	Ks 0.0000 0.0000 0.0000                // specular color 
                        
	Ke 0.0000 0.0000 0.0000                // emissive coeficient. It goes together with ambient, diffuse and specular and represents the 
                                               // amount of light emitted by the material.
	map_Ka textures\sponza_roof_diff.png   // ambient color texture file  
	map_Kd textures\sponza_roof_diff.png   // Color texture file to be applied to the diffuse reflectivity of the material. 
                                               // During rendering, map_Kd values are multiplied by the Kd values to derive the RGB components

illum

illum is interesting, there are a number of options, but as far as Wave is concerned, there are only two.

 Illumination    Properties that are turned on in the 
 model           Property Editor
 
 0		Color on and Ambient off
 1		Color on and Ambient on
 2		Highlight on
 3		Reflection on and Ray trace on
 4		Transparency: Glass on
 		Reflection: Ray trace on
 5		Reflection: Fresnel on and Ray trace on
 6		Transparency: Refraction on
 		Reflection: Fresnel off and Ray trace on
 7		Transparency: Refraction on
 		Reflection: Fresnel on and Ray trace on
 8		Reflection on and Ray trace off
 9		Transparency: Glass on
 		Reflection: Ray trace off
 10		Casts shadows onto invisible surfaces

1.3. textures

  • JPG and PNG are known to be supported.

References